<?php

// $Id: vpage_cache_form_ctrl.class.php 1570 2009-01-13 12:44:02Z ogrebg $

require_once(TANGRA_MAIN_DIR.'form/gform_ctrl_with_obj.class.php');

require_once('vpage_cache_form.class.php');
require_once('vpage_cache_form_view.class.php');

require_once($WSC->get_site_inc_dir().'modules/tangra_cms/classes/vpage/tcms_vpage_dbc.class.php');


class VPage_Cache_Form_Ctrl extends GForm_Ctrl_With_Object {
	protected function create_form() {
		$form = new VPage_Cache_Form();

//		$form->generate_html();
		return $form;
	}


	protected function create_form_view() {
		$ret = new VPage_Cache_Form_View($this->form);

		return $ret;
	}


	protected function on_good_submit() {
		$ret = true;

		return $ret;
	}


	protected function on_bad_submit() {

//		printbr('lajna');
	}


	protected function create_object() {
		$object = new TCMS_VPage_DBC();

		return $object;
	}


	protected function transfer_obj2form() {
		$object = $this->get_object();
		$form = $this->get_form();

		$form->set_field_value('cache', $object->get_cache());
		$form->set_field_value('cache_expiry', $object->get_cache_expiry());
	}


	protected function transfer_form2obj() {
		$object = $this->get_object();
		$form = $this->get_form();

		$object->set_cache($form->get_field_value('cache'));
		$object->set_cache_expiry($form->get_field_value('cache_expiry'));
	}
}